home *** CD-ROM | disk | FTP | other *** search
/ Champak 50 / Volume 50 - JOGO DISK .iso / Games / mallcrawl.swf / scripts / __Packages / mx / styles / CSSSetStyle.as next >
Encoding:
Text File  |  2007-09-28  |  10.1 KB  |  302 lines

  1. class mx.styles.CSSSetStyle
  2. {
  3.    var styleName;
  4.    var stylecache;
  5.    var _color;
  6.    var setColor;
  7.    var invalidateStyle;
  8.    static var classConstructed = mx.styles.CSSSetStyle.classConstruct();
  9.    static var CSSStyleDeclarationDependency = mx.styles.CSSStyleDeclaration;
  10.    function CSSSetStyle()
  11.    {
  12.    }
  13.    function _setStyle(styleProp, newValue)
  14.    {
  15.       this[styleProp] = newValue;
  16.       if(mx.styles.StyleManager.TextStyleMap[styleProp] != undefined)
  17.       {
  18.          if(styleProp == "color")
  19.          {
  20.             if(isNaN(newValue))
  21.             {
  22.                newValue = mx.styles.StyleManager.getColorName(newValue);
  23.                this[styleProp] = newValue;
  24.                if(newValue == undefined)
  25.                {
  26.                   return undefined;
  27.                }
  28.             }
  29.          }
  30.          _level0.changeTextStyleInChildren(styleProp);
  31.          return undefined;
  32.       }
  33.       if(mx.styles.StyleManager.isColorStyle(styleProp))
  34.       {
  35.          if(isNaN(newValue))
  36.          {
  37.             newValue = mx.styles.StyleManager.getColorName(newValue);
  38.             this[styleProp] = newValue;
  39.             if(newValue == undefined)
  40.             {
  41.                return undefined;
  42.             }
  43.          }
  44.          if(styleProp == "themeColor")
  45.          {
  46.             var _loc7_ = mx.styles.StyleManager.colorNames.haloBlue;
  47.             var _loc6_ = mx.styles.StyleManager.colorNames.haloGreen;
  48.             var _loc8_ = mx.styles.StyleManager.colorNames.haloOrange;
  49.             var _loc4_ = {};
  50.             _loc4_[_loc7_] = 12188666;
  51.             _loc4_[_loc6_] = 13500353;
  52.             _loc4_[_loc8_] = 16766319;
  53.             var _loc5_ = {};
  54.             _loc5_[_loc7_] = 13958653;
  55.             _loc5_[_loc6_] = 14942166;
  56.             _loc5_[_loc8_] = 16772787;
  57.             var _loc9_ = _loc4_[newValue];
  58.             var _loc10_ = _loc5_[newValue];
  59.             if(_loc9_ == undefined)
  60.             {
  61.                _loc9_ = newValue;
  62.             }
  63.             if(_loc10_ == undefined)
  64.             {
  65.                _loc10_ = newValue;
  66.             }
  67.             this.setStyle("selectionColor",_loc9_);
  68.             this.setStyle("rollOverColor",_loc10_);
  69.          }
  70.          _level0.changeColorStyleInChildren(this.styleName,styleProp,newValue);
  71.       }
  72.       else
  73.       {
  74.          if(styleProp == "backgroundColor" && isNaN(newValue))
  75.          {
  76.             newValue = mx.styles.StyleManager.getColorName(newValue);
  77.             this[styleProp] = newValue;
  78.             if(newValue == undefined)
  79.             {
  80.                return undefined;
  81.             }
  82.          }
  83.          _level0.notifyStyleChangeInChildren(this.styleName,styleProp,newValue);
  84.       }
  85.    }
  86.    function changeTextStyleInChildren(styleProp)
  87.    {
  88.       var _loc4_ = getTimer();
  89.       var _loc5_ = undefined;
  90.       for(_loc5_ in this)
  91.       {
  92.          var _loc2_ = this[_loc5_];
  93.          if(_loc2_._parent == this)
  94.          {
  95.             if(_loc2_.searchKey != _loc4_)
  96.             {
  97.                if(_loc2_.stylecache != undefined)
  98.                {
  99.                   delete _loc2_.stylecache.tf;
  100.                   delete _loc2_.stylecache[styleProp];
  101.                }
  102.                _loc2_.invalidateStyle(styleProp);
  103.                _loc2_.changeTextStyleInChildren(styleProp);
  104.                _loc2_.searchKey = _loc4_;
  105.             }
  106.          }
  107.       }
  108.    }
  109.    function changeColorStyleInChildren(sheetName, colorStyle, newValue)
  110.    {
  111.       var _loc6_ = getTimer();
  112.       var _loc7_ = undefined;
  113.       for(_loc7_ in this)
  114.       {
  115.          var _loc2_ = this[_loc7_];
  116.          if(_loc2_._parent == this)
  117.          {
  118.             if(_loc2_.searchKey != _loc6_)
  119.             {
  120.                if(_loc2_.getStyleName() == sheetName || sheetName == undefined || sheetName == "_global")
  121.                {
  122.                   if(_loc2_.stylecache != undefined)
  123.                   {
  124.                      delete _loc2_.stylecache[colorStyle];
  125.                   }
  126.                   if(typeof _loc2_._color == "string")
  127.                   {
  128.                      if(_loc2_._color == colorStyle)
  129.                      {
  130.                         var _loc4_ = _loc2_.getStyle(colorStyle);
  131.                         if(colorStyle == "color")
  132.                         {
  133.                            if(this.stylecache.tf.color != undefined)
  134.                            {
  135.                               this.stylecache.tf.color = _loc4_;
  136.                            }
  137.                         }
  138.                         _loc2_.setColor(_loc4_);
  139.                      }
  140.                   }
  141.                   else if(_loc2_._color[colorStyle] != undefined)
  142.                   {
  143.                      if(typeof _loc2_ != "movieclip")
  144.                      {
  145.                         _loc2_._parent.invalidateStyle();
  146.                      }
  147.                      else
  148.                      {
  149.                         _loc2_.invalidateStyle(colorStyle);
  150.                      }
  151.                   }
  152.                }
  153.                _loc2_.changeColorStyleInChildren(sheetName,colorStyle,newValue);
  154.                _loc2_.searchKey = _loc6_;
  155.             }
  156.          }
  157.       }
  158.    }
  159.    function notifyStyleChangeInChildren(sheetName, styleProp, newValue)
  160.    {
  161.       var _loc5_ = getTimer();
  162.       var _loc6_ = undefined;
  163.       for(_loc6_ in this)
  164.       {
  165.          var _loc2_ = this[_loc6_];
  166.          if(_loc2_._parent == this)
  167.          {
  168.             if(_loc2_.searchKey != _loc5_)
  169.             {
  170.                if(_loc2_.styleName == sheetName || _loc2_.styleName != undefined && typeof _loc2_.styleName == "movieclip" || sheetName == undefined)
  171.                {
  172.                   if(_loc2_.stylecache != undefined)
  173.                   {
  174.                      delete _loc2_.stylecache[styleProp];
  175.                      delete _loc2_.stylecache.tf;
  176.                   }
  177.                   delete _loc2_.enabledColor;
  178.                   _loc2_.invalidateStyle(styleProp);
  179.                }
  180.                _loc2_.notifyStyleChangeInChildren(sheetName,styleProp,newValue);
  181.                _loc2_.searchKey = _loc5_;
  182.             }
  183.          }
  184.       }
  185.    }
  186.    function setStyle(styleProp, newValue)
  187.    {
  188.       if(this.stylecache != undefined)
  189.       {
  190.          delete this.stylecache[styleProp];
  191.          delete this.stylecache.tf;
  192.       }
  193.       this[styleProp] = newValue;
  194.       if(mx.styles.StyleManager.isColorStyle(styleProp))
  195.       {
  196.          if(isNaN(newValue))
  197.          {
  198.             newValue = mx.styles.StyleManager.getColorName(newValue);
  199.             this[styleProp] = newValue;
  200.             if(newValue == undefined)
  201.             {
  202.                return undefined;
  203.             }
  204.          }
  205.          if(styleProp == "themeColor")
  206.          {
  207.             var _loc10_ = mx.styles.StyleManager.colorNames.haloBlue;
  208.             var _loc9_ = mx.styles.StyleManager.colorNames.haloGreen;
  209.             var _loc11_ = mx.styles.StyleManager.colorNames.haloOrange;
  210.             var _loc6_ = {};
  211.             _loc6_[_loc10_] = 12188666;
  212.             _loc6_[_loc9_] = 13500353;
  213.             _loc6_[_loc11_] = 16766319;
  214.             var _loc7_ = {};
  215.             _loc7_[_loc10_] = 13958653;
  216.             _loc7_[_loc9_] = 14942166;
  217.             _loc7_[_loc11_] = 16772787;
  218.             var _loc12_ = _loc6_[newValue];
  219.             var _loc13_ = _loc7_[newValue];
  220.             if(_loc12_ == undefined)
  221.             {
  222.                _loc12_ = newValue;
  223.             }
  224.             if(_loc13_ == undefined)
  225.             {
  226.                _loc13_ = newValue;
  227.             }
  228.             this.setStyle("selectionColor",_loc12_);
  229.             this.setStyle("rollOverColor",_loc13_);
  230.          }
  231.          if(typeof this._color == "string")
  232.          {
  233.             if(this._color == styleProp)
  234.             {
  235.                if(styleProp == "color")
  236.                {
  237.                   if(this.stylecache.tf.color != undefined)
  238.                   {
  239.                      this.stylecache.tf.color = newValue;
  240.                   }
  241.                }
  242.                this.setColor(newValue);
  243.             }
  244.          }
  245.          else if(this._color[styleProp] != undefined)
  246.          {
  247.             this.invalidateStyle(styleProp);
  248.          }
  249.          this.changeColorStyleInChildren(undefined,styleProp,newValue);
  250.       }
  251.       else
  252.       {
  253.          if(styleProp == "backgroundColor" && isNaN(newValue))
  254.          {
  255.             newValue = mx.styles.StyleManager.getColorName(newValue);
  256.             this[styleProp] = newValue;
  257.             if(newValue == undefined)
  258.             {
  259.                return undefined;
  260.             }
  261.          }
  262.          this.invalidateStyle(styleProp);
  263.       }
  264.       if(mx.styles.StyleManager.isInheritingStyle(styleProp) || styleProp == "styleName")
  265.       {
  266.          var _loc8_ = undefined;
  267.          var _loc5_ = newValue;
  268.          if(styleProp == "styleName")
  269.          {
  270.             _loc8_ = typeof newValue != "string" ? _loc5_ : _global.styles[newValue];
  271.             _loc5_ = _loc8_.themeColor;
  272.             if(_loc5_ != undefined)
  273.             {
  274.                _loc8_.rollOverColor = _loc8_.selectionColor = _loc5_;
  275.             }
  276.          }
  277.          this.notifyStyleChangeInChildren(undefined,styleProp,newValue);
  278.       }
  279.    }
  280.    static function enableRunTimeCSS()
  281.    {
  282.    }
  283.    static function classConstruct()
  284.    {
  285.       var _loc2_ = MovieClip.prototype;
  286.       var _loc3_ = mx.styles.CSSSetStyle.prototype;
  287.       mx.styles.CSSStyleDeclaration.prototype.setStyle = _loc3_._setStyle;
  288.       _loc2_.changeTextStyleInChildren = _loc3_.changeTextStyleInChildren;
  289.       _loc2_.changeColorStyleInChildren = _loc3_.changeColorStyleInChildren;
  290.       _loc2_.notifyStyleChangeInChildren = _loc3_.notifyStyleChangeInChildren;
  291.       _loc2_.setStyle = _loc3_.setStyle;
  292.       _global.ASSetPropFlags(_loc2_,"changeTextStyleInChildren",1);
  293.       _global.ASSetPropFlags(_loc2_,"changeColorStyleInChildren",1);
  294.       _global.ASSetPropFlags(_loc2_,"notifyStyleChangeInChildren",1);
  295.       _global.ASSetPropFlags(_loc2_,"setStyle",1);
  296.       var _loc4_ = TextField.prototype;
  297.       _loc4_.setStyle = _loc2_.setStyle;
  298.       _loc4_.changeTextStyleInChildren = _loc3_.changeTextStyleInChildren;
  299.       return true;
  300.    }
  301. }
  302.